﻿#if NET45
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Configuration;
using System.Linq;
using System.Net;
using System.Threading.Tasks;

namespace Longbow.Cache
{
    /// <summary>
    /// CacheList 配置项操作类
    /// </summary>
    internal class CacheListSection : ConfigurationSection
    {
        /// <summary>
        /// 默认配置小节项名称，默认值 cacheManagerList
        /// </summary>
        public const string DefaultSectionName = "cacheManagerList";

        /// <summary>
        /// 获得 是否启用本设置，默认为启用 true
        /// </summary>
        [ConfigurationProperty("enabled"), DefaultValue(true)]
        public bool Enabled
        {
            get { return (bool)this["enabled"]; }
        }

        /// <summary>
        /// CorsItems
        /// </summary>
        [ConfigurationProperty("", IsDefaultCollection = true)]
        public CacheCorsItemCollection CorsItems
        {
            get { return (CacheCorsItemCollection)this[""]; }
        }

        /// <summary>
        /// 获取配置小节方法
        /// </summary>
        /// <returns></returns>
        public static CacheListSection GetSection()
        {
            return ConfigurationManager.GetSection(DefaultSectionName) as CacheListSection;
        }
    }
}
#endif
